﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>读报告</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <!-- 移动设备支持 -->
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
    <meta content="no-cache" http-equiv="pragma">
    <meta content="0" http-equiv="expires">
    <meta content="telephone=no, address=no" name="format-detection">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <link type="text/css" rel="stylesheet" href="Public/mobile/js/layer/skin/layer.css?1"/>
    <link href="Public/mobile/css/reset.css?165" rel="stylesheet" type="text/css">
    <link href="Public/mobile/personal/css/explain.css" rel="stylesheet" type="text/css">
    <link href="Public/mobile/personal/css/new.css" rel="stylesheet" type="text/css">
    
    <script type="text/javascript">
      function onImageError(obj){
        obj.src="Public/home/images/default.gif";
    }
    </script>
</head>
<body>
<div id="wrap">
  <header class="header">
                <a id="btn_common_go_back" class="fhbtn" href="javascript:;"></a>
                <h2>在线咨询</h2>
                                                <a class="bcbtn" href="javascript:void(0);">发表</a>
                                  </header>
    
    <div>
        <form id="consult_form">
        <div class="sfzx_box">
            <div class="dhzx_inputbox mt10 before">
                <img src="Public/mobile/images/n_17.png">
                <input name="cy_id" value="5731" id="cy_id" type="hidden">
                <span class="dhzx_input" id="cy_name">18811742118</span>
            </div>
            <div class="dhzx_inputbox" style="border:none">
                <img src="Public/mobile/images/n_21.png">
                <span class="dhzx_input">问题描述</span>
            </div>
            <textarea class="wt_text" placeholder="请输入问题（至少20字）" name="content"></textarea>
            <ul class="zx-imglist">
            </ul>
            <div class="clear"></div>
            <div class="zx-img-tj">
                <a href="javascript:;" class="file"><img src="Public/mobile/images/twzx-tj.gif"></a>
                <p>上传体检报告或者病例<br>最多不超过5张</p>
            </div>
        </div>
            <input type="hidden" value="0" name="doctor_id" id="doctor_id" />
        </form>
        <input type="file" name="files[]" id="files" multiple=""  accept="image/*;capture=camera" style="position: absolute;top:-1000px;left:-1000px;" />
        <a class="com-btn" href="javascript:void (0);" style="display: none">提交</a>
        <a style="display: none;" class="cjwt_btn" href="javascript:void (0);"><img src="Public/mobile/images/n_19.png">常见问题</a>
    </div>
    <!-- <div class="pop_bg" style="max-width: 640px;min-width: 320px;margin:0 auto;left: auto">
        <div class="name_pop">
            <a href="javascript:;" data-cy_id="5731">18811742118</a>
                        <a href="/Mobile/Member/edit_cy/id/0.html">新增成员</a>
            <a class="mt20" href="javascript:;" data-cy_id="0">取消</a>
        </div>

    </div> -->
  </div>
<script type="text/javascript">
    // 定义一些常量
  var __public='/Public';
    //访问入口类型，值有：weixin微信,normal普通浏览器
  var __access_type__="normal";
  var __indexUrl__="/";//默认的首页地址,即当返回到顶层时的地址
  var __root__="/";//根目录地址
  var __appId = null;
  var __timestamp = null;
  var __nonceStr = null;
  var __signature = null;
  if(__access_type__ == 'weixin'){
      // 定义一些常量
      __appId = "";              // 必填，公众号的唯一标识
      __timestamp = "";  // 必填，生成签名的时间戳
      __nonceStr = "";           // 必填，生成签名的随机串
      __signature = "";  // 必填，签名，见附录1
  }
</script>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="Public/mobile/js/layer/layer.js?1"></script> 
<script type="text/javascript" src="Public/mobile/js/common.js?5"></script>
    
   <!-- <script type="text/javascript" src="/Public/mobile/js/consult.js"></script>-->

    <script>
        // 在线咨询js
        var max_photo_count = 5;
        var photo_count = 0;
        var max_size = 1024 * 1024 * 2;//最大2M的图片

        $(function(){
            $('.zx-img-tj :first a.file').on('click',function(e){
                e.preventDefault();
                if(photo_count < max_photo_count){
                    $("#files").click();
                }
                else{
                    zk_alert_msg("只能上传"+max_photo_count+"张图片");
                }
            });

            //预览图片
            $(document).on("change",'#files',function(){
                var reader;
                var file;
                var index = this.id.replace("photo","");
                var files_num = this.files.length;
                if((photo_count+files_num) > max_photo_count){
                    zk_alert_msg("只能上传"+max_photo_count+"张图片!");return;
                }
                for(var i=0;i<this.files.length;i++){
                    file=this.files[i];
                    //alert(file.size);
                    /*var size=file.size/1024;
                     if(size>1024){
                     size=size/1024;
                     }
                     if(file.size>max_size){
                        zk_alert_msg("您要上传的图片太大了！");
                        return;
                    }*/

                    reader = new FileReader();
                    reader.onload = function(e){
                        //zk_alert_msg(this.result);
                        $('<li><img src="'+this.result+'"><a href="javascrit:;">x</a><input type="hidden" name="photos[]" value="'+this.result+'" /></li>').appendTo('.zx-imglist');
                        //$('<div class="dp_img"><input type="hidden" name="photos[]" value="'+this.result+'" /><img src="'+this.result+'"><a href="javascrit:;">x</a></div>').insertBefore(".file");
                        photo_count++;
                        //updateImageCount(photo_count);
                        reader=null;
                    }
                    reader.readAsDataURL(file);
                }
            });

            //删除图片
            $(document).on(eventMap("click"),".zx-imglist a",function(e){
                e.preventDefault();
                var sender = $(this);
                sender.parent().remove();
                photo_count--;
            });
            //显示成员
            $(document).on(eventMap("click"),'.dhzx_input',function(){
                $('.pop_bg').slideDown(500);
            });
            //成员选择
            $(document).on(eventMap("click"),'.name_pop a',function(){
               var cy_id=($(this).attr('data-cy_id'));
                var name=$(this).text();
                if(parseInt(cy_id)!=0){
                   $('#cy_id').val(cy_id);
                    $('#cy_name').text(name)
                }
                $('.pop_bg').slideUp(500);
            });

            var click_flag=1;
            $(document).on(eventMap("click"),'.com-btn,.bcbtn',function(){

                if(click_flag==0){
                    return;
                }
                var pic = $(".zx-imglist").val();
                var content=$(".wt_text").val();
                if ((content == null || content == '') || content.length < 20) {
                    zk_alert_msg('为了问题描述清晰完整，不得少于20字')
                    return;
                }
                else {
                     zk_alert_msg('发表成功');
                     window.setTimeout("window.location='report.html'",2000);
                }
                $.ajax({
                    type:'post',
                    url:'/Mobile/Member/do_consult.html',
                    data:$('#consult_form').serialize() ,
                    dataType:'json',
                    beforeSend:function(){
                        dataLoading();
                    },
                    success:function(res) {
                        if (res.status == 1) {
                               location.href=res.go_url;
                        } else {
                            if (res.status == 1) {
                                zk_alert_msg(res.msg);
                            }
                        }
                    },
                    complete:function(){
                        removeDataLoading();
                    }
                });
                click_flag=0;
            });


        });

    </script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?7b2b4b745cfe9f106de279f1f705dd6c";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>